package tpo.lmhconsumer.lmhconsumer.controller;

import com.github.pagehelper.PageInfo;
import dto.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import pojo.Stock_list;
import pojo.Stock_order;
import tpo.lmhconsumer.lmhconsumer.service.StockService;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@RestController
public class StockController {
    @Autowired
    private StockService stockService;

    @RequestMapping("addStock_order")
    public Dto<Integer> addStock_order(@RequestBody GetStock getStock) {
        return stockService.addStock_order(getStock);
    }


    @RequestMapping("upStock_order")
    public Dto<Integer> upStock_order(@RequestBody GetStock getStock) {
        return stockService.upStock_order(getStock);
    }

    @RequestMapping("getStock_order")
    public Dto<PageInfo<ShowStock>> getStock_order(@RequestBody Map map) {
        return stockService.getStock_order(map);
    }

    @RequestMapping("nextStock_order")
    public Dto<Integer> nextStock_order(@RequestBody Map map) {
        return stockService.nextStock_order(map);
    }

    @RequestMapping("getStock_list")
    public Dto<List<ShowStock_list>> getStock_list(@RequestBody Map map) {
        return stockService.getStock_list(map);
    }

    @RequestMapping("delStock_order")
    public Dto<Integer> delStock_order(@RequestParam("code") String code) {
        return stockService.delStock_order(code);
    }

    @RequestMapping("getDb_order")
    public Dto<PageInfo<ShowDb_order>> getDb_order(@RequestBody Map map) {
        return stockService.getDb_order(map);
    }

    @RequestMapping("addDb_order")
    public Dto<Integer> addDb_order(@RequestBody GetStock getStock) {
        return stockService.addDb_order(getStock);
    }

    @RequestMapping("nextDb_order")
    public Dto<Integer> nextDb_order(@RequestBody Map map) {
        return stockService.nextDb_order(map);
    }

    @RequestMapping("getMingXi")
    public Dto<PageInfo<ShowStock_list>> getMingXi(@RequestBody Map map) {
        return stockService.getMingXi(map);
    }
}
